package com.yuncheng.spcyApi.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yuncheng.spcyApi.entity.SpcyJcyRckphpjl;
import com.yuncheng.spcyApi.mapper.SpcyJcyRckphpjlMapper;
import com.yuncheng.spcyApi.service.ISpcyJcyRckphpjlService;
import com.yuncheng.spcyApi.vo.jcy.JcyHpjlResVo;
import org.springframework.stereotype.Service;

import com.yuncheng.common.base.service.impl.BaseServiceImpl;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description: 检查员日常考评互评记录
 * @Author: yuncheng
 * @Date: 2024-01-12
 * @Version: V1.0
 */
@Service
public class SpcyJcyRckphpjlServiceImpl extends BaseServiceImpl<SpcyJcyRckphpjlMapper, SpcyJcyRckphpjl> implements ISpcyJcyRckphpjlService {

    @Resource
    private SpcyJcyRckphpjlMapper spcyJcyRckphpjlMapper;

    @Override
    public List<SpcyJcyRckphpjl> selectPjrJcyHpList(String sqsxid, String pjrid, boolean isBpjrzgOrder) {
        LambdaQueryWrapper<SpcyJcyRckphpjl> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(SpcyJcyRckphpjl::getFsqsxid, sqsxid);
        queryWrapper.eq(SpcyJcyRckphpjl::getFpjrid, pjrid);
        if (isBpjrzgOrder){
            queryWrapper.orderByAsc(SpcyJcyRckphpjl::getFbpjrzg);
        }
        return list(queryWrapper);
    }

    @Override
    public List<SpcyJcyRckphpjl> queryAllJcyHpjlList(String sqsxid) {
        LambdaQueryWrapper<SpcyJcyRckphpjl> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(SpcyJcyRckphpjl::getFsqsxid, sqsxid);
        queryWrapper.orderByAsc(SpcyJcyRckphpjl::getFpjrzg);
        return list(queryWrapper);
    }

    @Override
    public List<JcyHpjlResVo> selectBprListByPjrId(String sqsxid, String fpjrid) {
        return spcyJcyRckphpjlMapper.selectBprListByPjrId(sqsxid, fpjrid);
    }
}
